package cn.taoticket.service;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


import cn.taoticket.mapper.TaoticketItemTypeMapper;
import cn.taoticket.pojo.TaoticketItemType;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketItemTypeService {

    @Resource
     private TaoticketItemTypeMapper taoticketItemTypeMapper;

     @RequestMapping(value = "/getTaoticketItemTypeById",method = RequestMethod.POST)
     public TaoticketItemType getTaoticketItemTypeById(@RequestParam("id") Long id)throws Exception{
        return taoticketItemTypeMapper.getTaoticketItemTypeById(id);
     }

     @RequestMapping(value = "/getTaoticketItemTypeListByMap",method = RequestMethod.POST)
     public List<TaoticketItemType>	getTaoticketItemTypeListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemTypeMapper.getTaoticketItemTypeListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketItemTypeCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketItemTypeCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemTypeMapper.getTaoticketItemTypeCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketItemType",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketItemType(@RequestBody TaoticketItemType taoticketItemType)throws Exception{
        taoticketItemType.setCreatedTime(new Date());
        return taoticketItemTypeMapper.insertTaoticketItemType(taoticketItemType);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketItemType",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketItemType(@RequestBody TaoticketItemType taoticketItemType)throws Exception{
        taoticketItemType.setUpdatedTime(new Date());
        return taoticketItemTypeMapper.updateTaoticketItemType(taoticketItemType);
     }
}
